package away3d.events ;


import away3d.animators.AnimatorBase ;
import away3d.animators.data.AnimationSequenceBase ;
import flash.events.Event ;



/**
 * AnimationEvent is an Event dispatched to notify changes in an animation's state.
 */
class AnimatorEvent extends Event
{
    
    
    /**
     * Playback of the currently playing ( non-looping ) clip ended.
     */
    public static inline var SEQUENCE_DONE  : String = "SequenceDone" ;
    
    /**
     * Defines the value of the type property of a start event object.
     */
    public static inline var START          : String = "start" ;
    
    /**
     * Defines the value of the type property of a stop event object.
     */
    public static inline var STOP           : String = "stop" ;
    
    private var _sequence                   : AnimationSequenceBase ;
    private var _animator                   : AnimatorBase ;
    
    
    
    /**
     * Create a new GeometryEvent
     * @param type The event type.
     * @param subGeometry An optional SubGeometry object that is the subject of this event.
     */
    public function new( type : String, animator : AnimatorBase, ?sequence : AnimationSequenceBase = null )
    {
        
        super( type, false, false ) ;
        _sequence = sequence ;
        _animator = animator ;
        
    }
    
    
    public var animator( get_animator, null ) : AnimatorBase ;
    
    
    private function get_animator() : AnimatorBase
    {
        
        return _animator ;
        
    }
    
    
    public var sequence( get_sequence, null ) : AnimationSequenceBase ;
    
    
    /**
     * The SubGeometry object that is the subject of this event, if appropriate.
     */
    private function get_sequence() : AnimationSequenceBase
    {
        
        return _sequence ;
        
    }
    
    
    /**
     * Clones the event.
     * @return An exact duplicate of the current object.
     */
    override public function clone() : Event
    {
        
        return new AnimatorEvent( type, _animator, _sequence ) ;
        
    }
    
    
}
